﻿<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:asp="remove">

	<xsl:output method="xml" indent="yes" encoding="utf-8" omit-xml-declaration="yes"/>

	<xsl:template match="/">
		<xsl:choose>
			<xsl:when test="/SOAP-ENV:Envelope/SOAP-ENV:Body/SOAP-ENV:Fault/faultstring">
				<xsl:value-of select="/SOAP-ENV:Envelope/SOAP-ENV:Body/SOAP-ENV:Fault/faultstring" />
			</xsl:when>
      <xsl:when test="/SOAP-ENV:Envelope/SOAP-ENV:Body/Result/Item">
        <table cellpadding="3">
          <tr>
            <th>
              Name
            </th>
            <th>
              Value
            </th>
          </tr>
          <xsl:apply-templates />
        </table>
      </xsl:when>
			<xsl:otherwise>
				Item not found
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="Item">
    <tr>
      <td>
        Item Number
      </td>
      <td>
        <a>
          <xsl:value-of select="item_number" />
        </a>
      </td>
    </tr>
    <tr>
      <td>
        Name
      </td>
      <td>
        <a>
          <xsl:value-of select="name" />
        </a>
      </td>
    </tr>
    <tr>
      <td>
        Major Rev
      </td>
      <td>
        <a>
          <xsl:value-of select="major_rev" />
        </a>
      </td>
    </tr>
    <tr>
      <td>
        State
      </td>
      <td>
        <a>
          <xsl:value-of select="state" />
        </a>
      </td>
    </tr>
		<tr>
			<td>
				Type
			</td>
			<td>
				<a>
					<xsl:value-of select="classification" />
				</a>
			</td>
		</tr>
    <tr>
      <td>
        Make / Buy
      </td>
      <td>
        <a>
          <xsl:value-of select="make_buy" />
        </a>
      </td>
    </tr>
    <tr>
      <td>
        Unit
      </td>
      <td>
        <a>
          <xsl:value-of select="unit" />
        </a>
      </td>
    </tr>
    <tr>
      <td>
        Owned By ID
      </td>
      <td>
        <a>
          <xsl:value-of select="owned_by_id/@keyed_name" />
        </a>
      </td>
    </tr>
    <tr>
      <td>
        Release Date
      </td>
      <td>
        <a>
          <xsl:value-of select="release_date" />
        </a>
      </td>
    </tr>
	</xsl:template>

</xsl:stylesheet>